<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>fit-image-in-container</title>
    <style>
        .image {
            width: 200px;
            height: 200px;
            border: 1px solid #34495e;
            background-color: #34495e;
        }
        .image-contain {
            object-fit: contain;
            object-position: center;
        }
        .image-cover {
            object-fit: cover;
            object-position: right top;
        }
    </style>
</head>
<body>
    <img class="image image-contain" src="https://picsum.photos/600/200" />
    <img class="image image-cover" src="https://picsum.photos/600/200" />
</body>
</html>